import request from '@/utils/request'

// 获取-员工列表
export const getUserList = (params) => {
  return request.get('/sys/user', {
    params
  })
}
// 批量-导出员工excel
export const exportUser = () => {
  return request.get('/sys/user/export', {
    responseType: 'blob'
  })
}

// 下载导入员工模板
export const downloadTemplate = () => {
  return request.get('/sys/user/import/template', {
    responseType: 'blob'
  })
}

// 批量-导入员工(上传excel)
export const importUser = (data) => {
  return request.post('/sys/user/import', data)
}

// 新增员工
export const addUser = (data) => {
  return request.post('/sys/user', data)
}

// 获取-员工-基本信息
export const getUserDetail = (id) => {
  return request.get(`/sys/user/${id}`)
}

// 修改-员工-基本信息
export const editUser = (data) => {
  return request.put(`/sys/user/${data.id}`, data)
}

// 删除-员工
export const delUser = (id) => {
  return request.delete(`/sys/user/${id}`)
}

// 获取-已启用的角色列表
export const getRoleList = () => {
  return request.get('/sys/role/list/enabled')
}

// 分配-员工-角色
export const setRole = (data) => {
  return request.put('/sys/user/assignRoles', data)
}
